package server.business.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import server.business.pojo.AboType;
import server.business.service.AboTypeService;
import server.business.mapper.AboTypeMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
* @author Galaxy
* @description 针对表【abo_type(ABO血型)】的数据库操作Service实现
* @createDate 2022-11-08 12:46:23
*/
@Service("aboTypeService")
public class AboTypeServiceImpl extends ServiceImpl<AboTypeMapper, AboType>
    implements AboTypeService{
    @Autowired
    private AboTypeService aboTypeService;

    /**
     * 查询数据
     *
     * @return {@link List}<{@link AboType}>
     */
    public List<AboType> queryData(){
        List<AboType> list = aboTypeService.list();
        return list;
    }

    /**
     * fzx
     * @param BloodAbo
     * @return
     */
    public String getAbo(String BloodAbo) {
        QueryWrapper<AboType> aboType= new QueryWrapper<>();
        aboType
                .lambda()
                .eq(AboType::getCode, BloodAbo)
                .select(AboType::getName);
        List<Map<String, Object>> list = this.listMaps(aboType);
        return ((String) list.get(0).get("name"));

    }




}




